{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_tcwq/template/public/ygcsslist.css">
<style type="text/css">
    .ygrow{margin-top: 20px;font-size: 12px;}
    .ygmartop{margin-top: 30px;font-size: 12px;}
    .ygmartop2{margin-bottom: 10px;}
    .yg5_key>div{float: left;line-height: 34px;}
    .store_td1{height: 45px;}
    .store_list_img{width: 60px;height: 60px;}
    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;}
    .yg5_tr2>td{padding: 15px;border: 1px solid #e5e5e5;text-align: center;background-color: white;}
    .yg5_tr1>td{
        border: 1px solid #e5e5e5;
        padding-left: 15px;
        background-color: #FAFAFA;
        font-weight: bold;
        text-align: center;
    }
    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
    .yg5_btn2{background-color: white;color: #333;border: 1px solid white;border-radius: 6px;width: 100px;height: 34px;}
    .yg13_img{width: 50px;height: 50px;border-radius: 4px;}
    .yg_name{width: 30%;height: 34px;line-height: 34px;color: #333;float: left;background-color: white;border: 1px solid #E4E4E4;text-align: center;}
    .yg_left{float: left;}
    .form-control{width: 70%;}
    .ygseledi{width: 60%;}
    .dishes{display: flex;align-items: center;}
    .dishes_font{font-size: 20px;}
    .dishes_inp{width: 195px;height: 23px;border: none;}
    .dishes_inp2{margin-right: 20px;}
    .input_box{border: 2px solid #5bc0de;border-radius: 4px;padding: 5px;margin-right: 10px;background-color: #5bc0de;color: white;}
    .store_inp{margin-left: 5px;}
    .dish_left{margin-right: 20px;}
    .dish_btn>button,.dish_btn>a{margin-bottom: 10px;}
    .ygboxl{margin-bottom: 15px;}
    /*.ygboxl>.input-group{border:1px solid green;}*/
</style>
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
 <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('groupgoods',array('type'=>all));}">全部商品</a></li>
 <li   {if $type=='wait'} class="active" {/if}><a href="{php echo $this->createWebUrl('groupgoods',array('type'=>wait,'state'=>1));}">待审核</a></li>
 <li   {if $type=='ok'} class="active" {/if}><a href="{php echo $this->createWebUrl('groupgoods',array('type'=>ok,'state'=>2));}">已确认</a></li>
 <li   {if $type=='no'} class="active" {/if}><a href="{php echo $this->createWebUrl('groupgoods',array('type'=>no,'state'=>3));}">已拒绝</a></li>
</ul>
   	<div class="row ygmartop">
        <form action="" method="get" class="col-md-12" style="padding: 0px;">
            <div class="col-md-12 ygboxl">
               <input type="hidden" name="c" value="site" />
               <input type="hidden" name="a" value="entry" />
               <input type="hidden" name="m" value="zh_tcwq" />
               <input type="hidden" name="do" value="groupgoods" />
                <div class="col-md-2" style="padding: 0px;">
                    <div class="yg_name">商品/门店</div>
                    <input type="text" name="keywords" class="yg_left form-control" placeholder="商品/门店名称"> 
                </div>
              
                <div class="col-md-3">
                    <div class="yg_name">
                        商品状态
                    </div>
                    <select class="ygseledi" style="color: #333;" name="is_shelves2">
                      <option value="">不限</option>
                      <option value="1">已上架</option>
                      <option value="2">已下架</option>
                    </select>                
                </div>
                <div class="col-md-3">
                    <div class="yg_name">
                        商品分类
                    </div>
                    <select class="ygseledi" style="color: #333;" name="type_id">
                    <option value="">不限</option>
                    {loop $types  $item2}
                      <option value="{$item2['id']}">{$item2['name']}</option>
                      {/loop}
                    </select>                
                </div>
                <div class="col-md-1">
                    <input type="submit" value="搜索" name="submit" class="btn btn-primary btn-sm"/>
                    <input type="hidden" name="token" value="{$_W['token']}"/>
                </div>
            </div>
        </form>
  </div>
<div class="dishes">
	<button class="btn ygyouhui2  dish_left" id="allshang">批量上架</button>
	<button class="btn storegrey2  dish_left" id="alldown">批量下架</button>
  	<button class="btn ygshouqian2 dish_left" id="allselect">批量删除</button>
</div>
<div class="main">
    <div class="panel panel-default">
        <div class="panel-heading">
            商品列表
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                    	<td class="store_td1 col-md-1">
                            <input type="checkbox" class="allcheck" />
                            <span class="store_inp">全选</span>
                        </td>
                        <td class="">所属商家/城市</td>
                   		<td class="">商品图片</td>
                        <td class="">商品名称</td>
                        <td class="col-md-1">分类</td>
                        <td class="col-md-1">拼团价格</td>
                        <td class="col-md-1">单独够价格</td>
                        <td class="col-md-1">开团人数</td>
                       <!--  <td class="col-md-1">库存</td>
                        <td class="col-md-1">总销量</td> -->
                        <td class="col-md-1">平台显示</td>
                        <td class="col-md-1">是否上架</td>
                        <td class="col-md-1">状态</td>
                        <td class="col-md-2">操作</td>
                    </tr>
                     {loop $list $key $item}
                    <tr class="yg5_tr2">
                    	<td>
                            <input type="checkbox" name="test" value="{$item['id']}">
                        </td>

                        <td class="store_td1 col-md-1"> {$item['store_name']}{if $item['cityname']}({$item['cityname']}){else}（全国版）{/if}</td>
                         <td class="store_td1 col-md-1"> <img class="store_list_img" src="{media $item['logo']}" alt=""/></td>
                        <td class="col-md-1 cainame{$item['id']}">
                            <span class="caispan{$item['id']}">{$item['name']}</span>
                            <input style="display: none;width: 100%;" name="inp{$item['id']}" type="text" value="{$item['name']}" class="caininp{$item['id']}"/>
                            <script type="text/javascript">
							    $(function(){
							    	$(".cainame{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".caininp{$item['id']}").eq(index).show().focus();
							                $(".caispan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".caininp{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".caininp{$item['id']}").eq(index).hide();
							                $(".caispan{$item['id']}").eq(index).show();
							                var text = $(".caispan{$item['id']}").html();
							                var inp = $(" input[ name='inp{$item['id']}' ] ").val();
							                $(".caispan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        name = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_tcwq",
									    		dataType:"text",
										        data:{id:id,name:name},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                         <td class="col-md-1"> {$item['type_name']}</td>
                        <td class="col-md-1 money{$item['id']}">
                        	<span class="moneyspan{$item['id']}">{$item['pt_price']}</span>
                        	<input style="display: none;width: 100%;" type="text" name="money{$item['id']}" class="moneyinp{$item['id']}" value="{$item['money']}" />
                        	<script type="text/javascript">
							    $(function(){
							    	$(".money{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".moneyinp{$item['id']}").eq(index).show().focus();
							                $(".moneyspan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".moneyinp{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".moneyinp{$item['id']}").eq(index).hide();
							                $(".moneyspan{$item['id']}").eq(index).show();
							                var text = $(".moneyspan{$item['id']}").html();
							                var inp = $(" input[ name='money{$item['id']}' ] ").val();
							                $(".moneyspan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        money = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_tcwq",
									    		dataType:"text",
										        data:{id:id,money:money},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                        <td class="col-md-1 wm_money{$item['id']}">
                        	<span class="wmspan{$item['id']}">{$item['dd_price']}</span>
                        	<input style="display: none;width: 100%;" type="text" name="wmoney{$item['id']}" class="wmoney{$item['id']}" value="{$item['wm_money']}">
                        
                    		<script type="text/javascript">
							    $(function(){
							    	$(".wm_money{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".wmoney{$item['id']}").eq(index).show().focus();
							                $(".wmspan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".wmoney{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".wmoney{$item['id']}").eq(index).hide();
							                $(".wmspan{$item['id']}").eq(index).show();
							                var text = $(".wmspan{$item['id']}").html();
							                var inp = $(" input[ name='wmoney{$item['id']}' ] ").val();
							                $(".wmspan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        wm_money = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_tcwq",
									    		dataType:"text",
										        data:{id:id,wm_money:wm_money},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                        <td class="col-md-1 box_fee{$item['id']}">
                        	<span class="boxspan{$item['id']}">{$item['people']}</span>
                        	<input style="display: none;width: 100%;" type="text" name="boxinp{$item['id']}" class="boxinp{$item['id']}" value="{$item['people']}">
                        
                    		<script type="text/javascript">
							    $(function(){
							    	$(".box_fee{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".boxinp{$item['id']}").eq(index).show().focus();
							                $(".boxspan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".boxinp{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".boxinp{$item['id']}").eq(index).hide();
							                $(".boxspan{$item['id']}").eq(index).show();
							                var text = $(".boxspan{$item['id']}").html();
							                var inp = $(" input[ name='boxinp{$item['id']}' ] ").val();
							                $(".boxspan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        box_fee = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_tcwq",
									    		dataType:"text",
										        data:{id:id,box_fee:box_fee},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                       <!--  <td class="col-md-1 num{$item['id']}"> 
                        	<span class="numspan{$item['id']}">{$item['inventory']}</span>
                        	<input style="display: none;width: 100%;" type="text" name="numinp{$item['id']}" class="numinp{$item['id']}" value="{$item['num']}">
                        
                    		<script type="text/javascript">
							    $(function(){
							    	$(".num{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".numinp{$item['id']}").eq(index).show().focus();
							                $(".numspan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".numinp{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".numinp{$item['id']}").eq(index).hide();
							                $(".numspan{$item['id']}").eq(index).show();
							                var text = $(".numspan{$item['id']}").html();
							                var inp = $(" input[ name='numinp{$item['id']}' ] ").val();
							                $(".numspan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        num = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_tcwq",
									    		dataType:"text",
										        data:{id:id,num:num},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                        <td class="col-md-1 xs_num{$item['id']}"> 
                            <span class="xspan{$item['id']}">{$item['ysc_num']}</span>
                            <input style="display: none;width: 100%;" type="text" name="xinp{$item['id']}" class="xinp{$item['id']}" value="{$item['xs_num']}">
                        
                            <script type="text/javascript">
                                $(function(){
                                    $(".xs_num{$item['id']}").each(function(index){
                                         $(this).dblclick(function(){
                                            $(".xinp{$item['id']}").eq(index).show().focus();
                                            $(".xspan{$item['id']}").eq(index).hide();                                            
                                        });
                                    });
                                    $(".xinp{$item['id']}").each(function(index){
                                        $(this).blur(function(){            
                                            $(".xinp{$item['id']}").eq(index).hide();
                                            $(".xspan{$item['id']}").eq(index).show();
                                            var text = $(".xspan{$item['id']}").html();
                                            var inp = $(" input[ name='xinp{$item['id']}' ] ").val();
                                            $(".xspan{$item['id']}").html(inp);
                                            // console.log(inp);
                                            id = {$item['id']};
                                            xs_num = inp;
                                            $.ajax({
                                                type:"post",
                                                url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_tcwq",
                                                dataType:"text",
                                                data:{id:id,xs_num:xs_num},
                                                success:function(data){
                                                    console.log(data);
                                                }
                                            })
                                    
                                        });
                                    });
                                })
                            </script>
                        </td> -->
                               <td class="col-md-1 dish_btn">
                            {if $item['display']==1}
                              <button  type="button"  data-toggle="modal" data-target="#myModalo{$item['id']}" class="btn btn-xs storeblue">显示</button>
                            {elseif $item['display']==2}
                            <button type="button"  data-toggle="modal" data-target="#myModalp{$item['id']}" class="btn btn-xs storegrey">隐藏</button>
                            {/if}
                            <input type="hidden" value="{$item['is_shelves']}" name="updtype"/>
                            </td>
                         <td class="col-md-1 dish_btn">
                            {if $item['is_shelves']==1}
                              <button  type="button"  data-toggle="modal" data-target="#myModalc{$item['id']}" class="btn btn-xs storeblue">点击下架</button>
                            {elseif $item['is_shelves']==2}
                            <button type="button"  data-toggle="modal" data-target="#myModalb{$item['id']}" class="btn btn-xs storegrey">点击上架</button>
                            {/if}
                            <input type="hidden" value="{$item['is_shelves']}" name="updtype"/>
                            </td>
                          {if $item['state']==1}
                        <td>
                            <span class="label storered">待审核</span>
                        </td >
                        {elseif $item['state']==2}
                        <td >
                            <span class="label storeblue">已通过</span>
                        </td>
                        {elseif $item['state']==3}
                        <td>
                           <span class="label storegrey">已拒绝</span>
                       </td>
                       {/if} 
                                
                            <td class="col-md-2 dish_btn">
                              {if $item['state']==1}
                           <a href="{php echo $this->createWebUrl('groupgoods',array('op'=>'tg','cid'=>$item['id']));}"><button class="btn storeblue btn-xs">通过</button></a>
                           <a href="{php echo $this->createWebUrl('groupgoods',array('op'=>'jj','cid'=>$item['id']));}"><button class="btn storegrey btn-xs">拒绝</button></a>
                           {/if}
                                <a href="{php echo $this->createWebUrl('groupgoodsinfo', array('id' => $item['id']))}" class="storespan btn btn-xs">
                                    <span class="fa fa-pencil"></span>
                                    <span class="bianji">编辑
                                        <span class="arrowdown"></span>
                                    </span>                                
                                </a>
            
                                <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">
                                    <span class="fa fa-trash-o"></span>
                                    <span class="bianji">删除
                                        <span class="arrowdown"></span>
                                    </span>
                                </a>
                                <!-- <a class="btn btn-success btn-sm" href="{php echo $this->createWebUrl('adddishes', array('id' => $item['id']))}" title="编辑">编辑</a>
                                &nbsp;&nbsp;<a class="btn btn-success btn-sm" href="{php echo $this->createWebUrl('spec',array('dishes_id' => $item['id']));}" title="添加规格">添加规格</a>
                                &nbsp;&nbsp;<button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#myModal{$item['id']}">删</button> -->
                            </td>
                        </tr>                          
                     
                    <div class="modal fade" id="myModal{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('groupgoods', array('op' => 'delete', 'delid' => $item['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            
                <div class="modal fade" id="myModalo{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定隐藏么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('groupgoods',array('did'=>$item['id'],'display'=>2,'op' => 'play','page'=>$_GPC['page'],'keywords'=>$_GPC['keywords'],'dishes_type'=>$_GPC['dishes_type'],'type_id'=>$_GPC['type_id']));}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>

             <div class="modal fade" id="myModalp{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定显示么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('groupgoods',array('did'=>$item['id'],'display'=>1,'op' => 'play','page'=>$_GPC['page'],'keywords'=>$_GPC['keywords'],'dishes_type'=>$_GPC['dishes_type'],'type_id'=>$_GPC['type_id']));}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
                <div class="modal fade" id="myModalb{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定上架么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('groupgoods',array('id'=>$item['id'],'is_shelves'=>1,'page'=>$_GPC['page'],'keywords'=>$_GPC['keywords'],'dishes_type'=>$_GPC['dishes_type'],'type_id'=>$_GPC['type_id'],'is_shelves2'=>$_GPC['is_shelves2']));}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>

             <div class="modal fade" id="myModalc{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定下架么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('groupgoods',array('id'=>$item['id'],'is_shelves'=>2,'page'=>$_GPC['page'],'keywords'=>$_GPC['keywords'],'dishes_type'=>$_GPC['dishes_type'],'type_id'=>$_GPC['type_id'],'is_shelves2'=>$_GPC['is_shelves2']));}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>

                {/loop}
                {if empty($list)}
                <tr class="yg5_tr2">
                    <td colspan="12">
                      暂无商品信息
                    </td>
                </tr>
                {/if}
                </table>
            </div>
        </div>
    </div>
</div>
<div class="text-right we7-margin-top">{$pager}</div>

<script type="text/javascript">
    $(function(){
    	// $("#frame-2").addClass("in");
        $("#frame-22").show();
        $("#yframe-22").addClass("wyactive");
    	// —————批量上架—————
    	$("#allshang").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要上架的商品!');
                return false;
            }else if(confirm("确认要上架此商品?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
               console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupsj&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                        location.reload();
                    }
                })
               
            }
        });

    	// 批量下架
        $("#alldown").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要下架的商品!');
                return false;
            }else if(confirm("确认要下架此商品?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
               console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupxj&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                        location.reload();
                    }
                })
               
            }
        });

        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });

        $("#allselect").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要删除的商品!');
                return false;
            }else if(confirm("确认要删除此商品?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
               // console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=delgroup&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                        location.reload();
                    }
                })
               
            }
        });
        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });
        
    })
</script>

{template 'common/footer'}